<% add_decidim_page_title(t(".title")) %>

<div class="card">
  <div class="item_show__header">
    <h1 class="item_show__header-title">
      <%= t(".title") %>
      <div class="flex align-middle gap-x-4 ml-auto">
        <%= export_dropdown if allowed_to? :export, :debates %>
        <%= link_to t("actions.new", scope: "decidim.debates"), new_debate_path, class: "button button__sm button__secondary" if allowed_to? :create, :debate %>
        <%= render partial: "decidim/admin/components/resource_action" %>
      </div>
    </h1>
  </div>
  <div class="table-stacked">
    <table class="table-list">
      <%= render partial: "debates-thead" %>
      <tbody>
        <%= render partial: "decidim/debates/admin/debates/debate-tr",
                   collection: debates,
                   as: :debate,
                   locals: { view: :index } %>
      </tbody>
    </table>
  </div>
  <% if allowed_to? :manage_trash, :debate, participatory_space: current_participatory_space %>
    <div class="card mt-4">
      <%= link_to manage_trash_debates_path, class: "flex items-center  text-secondary" do %>
        <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
        <%= t("actions.view_deleted_debates", scope: "decidim.debates") %>
        <span class="ml-2">
          <%= icon_with_tooltip("information-line", t("actions.deleted_debate_info", scope: "decidim.debates")) %>
        </span>
      <% end %>
    </div>
  <% end %>
</div>
